package kz.kstu.scantest.app.delegate.impl;

import kz.kstu.scantest.app.delegate.api.TestDelegate;
import kz.kstu.scantest.app.util.locator.ServiceLocator;
import kz.kstu.scantest.app.util.locator.factory.ServiceLocatorFactory;
import kz.kstu.scantest.business.entity.test.Test;
import kz.kstu.scantest.facade.ejb.api.TestFacade;

import java.util.Collection;

/**
 * @author Filipp_Stankevich
 *         created: 13.09.11 22:16
 */
public class TestDelegateImpl implements TestDelegate {

    @Override
    public void saveTests(Collection<Test> tests) {
        getTestFacade(true).saveTests(tests);
    }

     private TestFacade getTestFacade(boolean isOnline) {
        ServiceLocator serviceLocator = ServiceLocatorFactory.getServiceLocator(isOnline);
        return serviceLocator.getService(TestFacade.SERVICE_NAME, TestFacade.class);
    }
}
